package cn.damong.weixin.mp;

/**
 * 
 * 微信公众号相关配置
 * 
 * @author CodingPanda
 * @2019年5月8日 下午11:30:40
 *
 */
public class WeixinMPConfig {
    
    /**
     * 公众号的唯一标识
     */
	private String appId;
	
	/**
	 * 公众号API密匙
	 */
	private String appSecret;
	
	/**
     * 微信网页授权回调地址，用于获取用户身份
     * 微信授权页面首先引导用户授权，用户确认授权后，微信服务器会将用户的授权code发送到这个回调地址。
     * redirectUri必须是真实公网可访问的域名网址，且与微信公众号后台设置一致
     */
	private String redirectUri;
	
	public WeixinMPConfig() {
		
	}
	
	public WeixinMPConfig(String appId, String appSecret) {
		this.appId = appId;
		this.appSecret = appSecret;
	}

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getAppSecret() {
        return appSecret;
    }

    public void setAppSecret(String appSecret) {
        this.appSecret = appSecret;
    }

    public String getRedirectUri() {
        return redirectUri;
    }

    public void setRedirectUri(String redirectUri) {
        this.redirectUri = redirectUri;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((appId == null) ? 0 : appId.hashCode());
        result = prime * result + ((appSecret == null) ? 0 : appSecret.hashCode());
        result = prime * result + ((redirectUri == null) ? 0 : redirectUri.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        WeixinMPConfig other = (WeixinMPConfig) obj;
        if (appId == null) {
            if (other.appId != null) {
                return false;
            }
        } else if (!appId.equals(other.appId)) {
            return false;
        }
        if (appSecret == null) {
            if (other.appSecret != null) {
                return false;
            }
        } else if (!appSecret.equals(other.appSecret)) {
            return false;
        }
        if (redirectUri == null) {
            if (other.redirectUri != null) {
                return false;
            }
        } else if (!redirectUri.equals(other.redirectUri)) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "WeixinConfig [appId=" + appId + ", appSecret=" + appSecret + ", redirectUri=" + redirectUri + "]";
    }

}
